﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式之禅.工厂模式.简单工厂模式
{
    public abstract class Product
    {
        public abstract string Say();
    }

    public class ProductA : Product
    {
        public override string Say()
        {
            return "A";
        }
    }
    public class ProductB : Product
    {
        public override string Say()
        {
            return "B";
        }
    }


    public class ConcreteCreator
    {
        //区别点
        public static Product FactoryMethod(string type)
        {
            Product p;
            if (type.Equals("A"))
                p = new ProductA();
            else
                p = new ProductB();
            return p;
        }
    }


}
